<template>
    <div>
        <template-Table :tableParams="tableParams" :buttons="buttons" 
        @formCommHandler="formCommHandler"
        @selectionChange="selectionChange"
        >
            <template #table_after_son>
                <el-table-column align="center" label="操作" width="200" :resizable="false">
                    <template slot-scope="scope">
                        <el-button class="edit-bgc" icon="el-icon-edit" @click="EditHandle(scope.row)">编辑</el-button>
                        <el-button class="edit-bgc" icon="el-icon-edit" type="danger" @click="delHandle(scope.row)">删除</el-button>
                    </template>
                </el-table-column>
            </template>
        </template-Table>
    </div>
</template>
<script>
import templateTable from '@/components/templateTableeg'
import {queryApi, fileUpload, fileUploadvideo} from '@/api/api'
export default {
    name: 'ParentChildTemplate',
    props:{

    },
    components:{
        templateTable
    },
    data() {
        return {
                tableParams: {
                dragStateFlag:false,//是否拖拽表头
                tableRowClassName:this.tableRowClassNameColor,
                // 表格接口地址  详细地址在api配置
                // url:urlCommon.queryApi.url,
                // height:''
                apiName: '',//"queryApi"
                tableStyle: 1, //1--主子表格上下布局  2---主子表格左右布局
                // 风格主题
                // tooltip:"dark",
                // 表头数据
                columns:[
                    // {prop: '', label: '', width: '60', align: 'center',type:"selection",fixed:'',isShow:true},
                    {prop: 'classificationStr', label: '部门名称', align: 'center',type:"",fixed:'',isShow:false},
                    {prop: 'level', label: '部门描述', align: 'center',type:"",fixed:''},
                ],
                // 校验规则
                rules:{},
                // 表格数据
                tableData: [
                    {id:1,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护口罩","commodityTypeId":"10000","level":1,"levelDesc":"可以上"},
                    {id:2,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 一次性口罩","commodityTypeId":"10001","level":1,"levelDesc":"可以上"},
                    {id:3,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护面具及配件","commodityTypeId":"10002","level":1,"levelDesc":"可以上"},
                    {id:4,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    {id:5,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 一次性口罩","commodityTypeId":"10001","level":1,"levelDesc":"可以上"},
                    {id:6,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护面具及配件","commodityTypeId":"10002","level":1,"levelDesc":"可以上"},
                    {id:7,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    {id:8,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 一次性口罩","commodityTypeId":"10001","level":1,"levelDesc":"可以上"},
                    {id:9,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护面具及配件","commodityTypeId":"10002","level":1,"levelDesc":"可以上"},
                    {id:10,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    {id:4,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    {id:5,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 一次性口罩","commodityTypeId":"10001","level":1,"levelDesc":"可以上"},
                    {id:6,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护面具及配件","commodityTypeId":"10002","level":1,"levelDesc":"可以上"},
                    {id:7,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    {id:8,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 一次性口罩","commodityTypeId":"10001","level":1,"levelDesc":"可以上"},
                    {id:9,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 防护面具及配件","commodityTypeId":"10002","level":1,"levelDesc":"可以上"},
                    {id:10,"classificationStr":"劳保/安全/消防 - 呼吸防护 - 电动送风呼吸防护系统","commodityTypeId":"10003","level":1,"levelDesc":"可以上"},
                    
                ],
                //主表主键  主子表的时候必填
                id: "id",
                // 分页
                pageSizeOpt: ['10','20','50','100','200'],
                pageNum:1,
                pageSize:10,
                // 表格高度最大值
                maxHeight:300, //上下布局主子表250 单表450
            },
            buttons:{
                align: 'right',
                buttons:[
                    {type: 'childAdd', content: '新增', status: 'primary', size:"mini"}
                ]
            }
        }
    },
    methods:{
        tableRowClassNameColor(){//行换色方法

        },
        formCommHandler(data){
            if(data.type="childAdd"){// childAdd 新增点击方法
                alert("新增方法")
            }
        },
        tableSelect(selection){//选中方法

        },
        EditHandle(row){
            alert("编辑方法")
        },
        delHandle(row){
            alert("删除方法")
        }
    }
}
</script>